package cn.seqdata.cxf.converter;

import javax.ws.rs.ext.ParamConverter;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.format.ISODateTimeFormat;

public class LocalDateConverter implements ParamConverter<LocalDate> {

	@Override
	public LocalDate fromString(String value) {
		return DateTime.parse(value, ISODateTimeFormat.dateOptionalTimeParser())
			.toLocalDate();
	}

	@Override
	public String toString(LocalDate value) {
		return value.toString();
	}
}
